package com.homegoods.orderinfodetail.model;

import android.graphics.Rect;
import android.os.Parcel;
import android.support.annotation.Nullable;

import com.previewlibrary.enitity.IThumbViewInfo;

/**
 * @author QiQi
 * @ClassName: PicViewInfo
 * @date 2018/9/22
 * @description
 */
public class PicViewInfo implements IThumbViewInfo {

    private String imgUrl;

    private Rect bound;

    @Override
    public String getUrl() {
        return imgUrl;
    }

    @Override
    public Rect getBounds() {
        return bound;
    }

    @Nullable
    @Override
    public String getVideoUrl() {
        return null;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public void setBound(Rect bound) {
        this.bound = bound;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.imgUrl);
        dest.writeParcelable(this.bound, flags);
    }

    public PicViewInfo() {
    }

    protected PicViewInfo(Parcel in) {
        this.imgUrl = in.readString();
        this.bound = in.readParcelable(Rect.class.getClassLoader());
    }

    public static final Creator<PicViewInfo> CREATOR = new Creator<PicViewInfo>() {
        @Override
        public PicViewInfo createFromParcel(Parcel source) {
            return new PicViewInfo(source);
        }

        @Override
        public PicViewInfo[] newArray(int size) {
            return new PicViewInfo[size];
        }
    };
}
